﻿using Gallery.Datas.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gallery.Datas
{
	public class FundDbService
	{

		public static FundDbService Instance = new FundDbService();

		public void AddFund(Fund fund)
		{
		
		}

		public void DeleteFund(String code)
		{
 
		}

		public void UpdateFund(Fund fund)
		{ 
		
		}

		public Fund GetFund(String code)
		{
			using(var db = new GalleryEntities())
			{
				return db.Funds.Where(p => p.Code == code).SingleOrDefault();
			}
		}

		public List<Fund> GetAllFunds()
		{
			using (var db = new GalleryEntities())
			{
				return db.Funds.ToList();
			}
		}
	}
}
